< previous page page_612 next page >

Page 612
Now, when you select an item from the combo box, you can retrieve the Key property from the combo box. Below is some code youll write for the Click() event of the combo box:
9f31265bb40b592b1929e18a47ab28e5.gif
Private Sub cboCountries_Click()
   Dim strKey As String

   If cboCountries.ListIndex <> -1 Then
      strKey = Mid$(cboCountries, _
                    InStr(cboCountries, vbTab) + 1)
      Set imgFlag.Picture = _
            ilsFlags.ListImages(strKey).Picture
   End If
End Sub
In the Click event of the combo box, you retrieve the Key value by parsing the Text property of the combo box and looking for the tab character. When you find it, you grab the value after that tab character; this is the Key value you use to retrieve the picture from the ListImages collection.
Toolbar
A common interface in a Windows applications is a toolbar. A toolbar generally resides at the top of a form, just below a menu bar. The toolbar has several icons that allow the user to perform common commands in the application with the click of a mouse. This can sometimes save the user many keystrokes. Windows 95/98 and Windows NT provide a standard toolbar control you can use in your Visual Basic applications. The toolbar control is a part of the Microsoft Windows common controls.
The toolbar control relies on a collection of Button objects that you define. Youll create one Button object for each button you want displayed on your toolbar. The Button object may have a text description or an icon, or both. Button objects can be created at runtime, or they can be created at design time using the toolbar property sheet.
Toolbar Common Properties
Lets take a look at the most commonly used properties for the toolbar control. In Table 30.2, youll find a list of these properties and a description of each.

 
< previous page page_612 next page >

If you like this book, buy it!